package
{
	import data.DataFactory;
	import data.events.DataEvent;
	
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	
	import helper.DebugStats;
	
	import view.states.StateType;
	import view.states.StateViewBase;
	
	[SWF(width = "1000",height = "600",frameRate = "25")]
	public class Main extends Sprite
	{
		private var _appRegister:AppRegister;
		private var _stateCreator:StateCreator;
		
		public function Main()
		{
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			_appRegister=new AppRegister();
			addChild(_appRegister);
			
			DataFactory.Instance.addEventListener(DataEvent.DATA_FACTORY_REGISTER_COMPLETE, dataFactoryRegisterComplete);
		}
		
		private function dataFactoryRegisterComplete(evt:DataEvent):void
		{
			_stateCreator=new StateCreator();
			var gameState:StateViewBase = _stateCreator.create(StateType.GAME);
			addChild(gameState);
			
			var fpsContainer:DebugStats = new DebugStats();
			addChild(fpsContainer);
		}
	}
}